package com.zxjbyte.yiyi.framework.quartz.config;

import com.zxjbyte.yiyi.framework.quartz.enums.JobAlarmTypeEnum;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.time.Duration;

/**
 * @Author zhangxingjia
 * @Date 2023/11/13 19:54
 * @Version: 1.0
 */
@Getter
@Setter
@ConfigurationProperties(QuartzProperties.QUARTZ_PROPS_PREFIX)
public class QuartzProperties {

    public static final String QUARTZ_PROPS_PREFIX = "yiyi.job.quartz";

    /**
     * 任务告警
     */
    private JobAlarmProp jobAlarm = new JobAlarmProp();


    @Getter
    @Setter
    public static class JobAlarmProp{

        // 任务报警类型
        private JobAlarmTypeEnum jobAlarmType = JobAlarmTypeEnum.TIMEOUT;

        // 任务执行超时时间 默认：10秒
        private Duration timeout = Duration.ofSeconds(10);

        // 负责人
        private String author;

        // 告警邮件
        private String toEmailAddress;
    }
}
